
// <copyright file="GenericResponse.cs" company="Subhadra Software Solutions">
//   
// </copyright>
// <summary>
//   Represents generic response.
// </summary>

namespace SubhadraSolutions.Sharp.Utils.RequestProcessing
{
    using System;
    using System.Runtime.Serialization;

    using SubhadraSolutions.Sharp.Utils.Reflection;

    /// <summary>
    /// The GenericResponse class.
    /// </summary>
    [Serializable]
    [DataContract]
    public class GenericResponse : IResponse
    {
        #region Constructors and Finalizers

        /// <summary>
        /// Initializes a new instance of the <see cref="GenericResponse" /> class.
        /// </summary>
        public GenericResponse()
        {
            this.Result = ProcessingResult.Fail;
        }

        #endregion

        #region Public Properties

        /// <summary>
        /// Gets or sets the message.
        /// </summary>
        /// <value>
        /// The message.
        /// </value>
        [DataMember]
        public string Message { get; set; }

        /// <summary>
        /// Gets or sets the exception.
        /// </summary>
        /// <value>
        /// The exception.
        /// </value>        
        [DataMember]
        public Exception Exception { get; set; }

        /// <summary>
        ///     Gets or sets the request identifier.
        /// </summary>
        /// <value>
        ///     The request identifier.
        /// </value>
        [DataMember(IsRequired = true)]
        public virtual string RequestId { get; set; }

        /// <summary>
        ///     Gets or sets the result.
        /// </summary>
        /// <value>
        ///     The result.
        /// </value>
        [DataMember(IsRequired = true)]
        public ProcessingResult Result { get; set; }

        /// <summary>
        /// Returns a <see cref="System.String" /> that represents this instance.
        /// </summary>
        /// <returns>
        /// A <see cref="System.String" /> that represents this instance.
        /// </returns>
        public override string ToString()
        {
        	return DynamicToStringHelper<GenericResponse>.ExportAsString(this);
        }

        #endregion
    }
}